<script setup lang="ts">
import { useRandomTestingStore } from '../../store'

const rootStore = useRandomTestingStore()
const { pageConfigStore, plainStore } = rootStore
const { titleFontSize, titleFontWeight, answerFontSize, answerFontWeight } = pageConfigStore
const {
  onResetPageConfig,
  loading,
  onClickReset,
  onClickResetDoneStatus,
  onClickResetCurrentTestDoneTatus,
} = plainStore
</script>

<template>
  <AForm layout="vertical">
    <AFormItem label="题目字体大小">
      <AInputNumber
        style="width: 100%"
        v-model:value="titleFontSize"
        addon-after="px"
        min="20"
      ></AInputNumber>
    </AFormItem>
    <AFormItem label="题目字体粗细">
      <AInputNumber
        style="width: 100%"
        v-model:value="titleFontWeight"
        addon-after="x100"
        min="1"
        max="9"
      ></AInputNumber>
    </AFormItem>
    <AFormItem label="答案字体大小">
      <AInputNumber
        style="width: 100%"
        v-model:value="answerFontSize"
        addon-after="px"
        min="14"
      ></AInputNumber>
    </AFormItem>
    <AFormItem label="答案字体粗细">
      <AInputNumber
        style="width: 100%"
        v-model:value="answerFontWeight"
        addon-after="x100"
        min="1"
        max="9"
      ></AInputNumber>
    </AFormItem>
    <AFormItem>
      <AButton type="primary" @click="onResetPageConfig">重置样式</AButton>
    </AFormItem>
    <AFormItem>
      <a-popconfirm
        title="确定清除缓存么?"
        ok-text="确定"
        cancel-text="取消"
        @confirm="onClickReset"
      >
        <AButton :disabled="loading">清除缓存</AButton>
      </a-popconfirm>
    </AFormItem>
    <AFormItem>
      <a-popconfirm
        title="确定清除当前题库已完成记录么?"
        ok-text="确定"
        cancel-text="取消"
        @confirm="onClickResetCurrentTestDoneTatus"
      >
        <AButton :disabled="loading" danger>清除当前题库已完成记录</AButton>
      </a-popconfirm>
    </AFormItem>
    <AFormItem>
      <a-popconfirm
        title="确定清除所有已完成记录么?"
        ok-text="确定"
        cancel-text="取消"
        @confirm="onClickResetDoneStatus"
      >
        <AButton :disabled="loading" danger>清除所有已完成记录</AButton>
      </a-popconfirm>
    </AFormItem>
  </AForm>
</template>
